﻿<%-- 
    Copyright (C) Binod Nepal, Planet Earth Solutions Pvt. Ltd., Kathmandu.
	Released under the terms of the GNU General Public License, GPL, 
	as published by the Free Software Foundation, either version 3 
	of the License, or (at your option) any later version.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
--%>

<%@ Page Title="" Language="C#" MasterPageFile="~/Classifieds/Main.Master" AutoEventWireup="true"
    CodeBehind="Sell.aspx.cs" Inherits="MixNP.Web.Classifieds.Sell" ValidateRequest="false" %>

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Microsoft.CSharp" %>
<%@ Import Namespace="System.CodeDom.Compiler" %>
<%@ Import Namespace="System.Reflection" %>
<asp:Content ID="Content1" ContentPlaceHolderID="StyleSheetContentPlaceHolder" runat="server">
    <style type="text/css">

    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ScriptsContentPlaceHolder" runat="server">
    <script src="/Resources/Scripts/markdown/Markdown.Converter.js" type="text/javascript"></script>
    <script src="/Resources/Scripts/markdown/Markdown.Sanitizer.js" type="text/javascript"></script>
    <script src="/Resources/Scripts/markdown/Markdown.Editor.js" type="text/javascript"></script>
    <link rel="stylesheet" href="/Resources/Scripts/hoverzoom/jquery.hoverZoom.css" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="BodyContentPlaceHolder" runat="server">
    <asp:ScriptManager runat="server" EnablePartialRendering="true" />
    <h1>
        <asp:Literal ID="CategoryNameLiteral" runat="server" />
    </h1>
    <hr class="hr" />

    <p>
        <a href="javascript:history.go(-1);" class="backbutton" title="Back" tabindex="10">Back</a>
    </p>

    <table>
        <tr>
            <td>
                <label id="Label5" runat="server" class="label">
                    City
                </label>
            </td>
        </tr>
        <tr>
            <td>
                <pes:CityDropDownList ID="CityDropDownList" runat="server" CssClass="dropdownlist wide"
                    TabIndex="20" />
            </td>
        </tr>
    </table>
    <div id="placeholder" runat="server" style="width: 100%;">
    </div>
    <table style="width: 100%;">
        <tr>
            <td>
                <label id="Label3" runat="server" class="label">
                    Details
                </label>
            </td>
        </tr>
        <tr>
            <td>
                <table>
                    <tr>
                        <td>
                            <div id="wmd-button-bar">
                            </div>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr style="vertical-align: top;">
                        <td>
                            <asp:TextBox ID="WdmTextBox" runat="server" TextMode="MultiLine" Style="padding: 12px;
                                width: 450px; height: 400px;" MaxLength="1200" TabIndex="350">
                            </asp:TextBox>
                            <asp:HiddenField ID="HiddenMarkdow" runat="server" />
                        </td>
                        <td>
                            <div id="preview" style="padding: 0px 12px 0px 12px; height: 426px; overflow: auto;width: 450px;">
                                <div id="wmd-preview" class="wmd-panel wmd-preview">
                                </div>
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <div class="note">
                    Please provide a detailed information about your advertisement. HTML code is not
                    allowed.
                    <hr class="hr" />
                </div>
            </td>
        </tr>
    </table>
    <div id="customPlaceholder" runat="server" style="width: 100%;">
    </div>
    <table style="width: 100%;">
        <tr>
            <td>
                <label id="Label4" runat="server" class="label">
                    Add More Fields?
                </label>
            </td>
        </tr>
        <tr>
            <td>
                <input tabindex="5400" type="radio" name="AddFieldRadio" id="AddFieldYesRadio" value="Yes"
                    onclick="$('#extra-fields-container').show(1000);if(counter==1){addFields();}" />
                <label for="AddFieldYesRadio">
                    Yes</label>
                <input tabindex="5400" type="radio" name="AddFieldRadio" id="AddFieldNoRadio" value="No"
                    checked="checked" onclick="$('#extra-fields-container').hide(1000);" />
                <label for="AddFieldNoRadio">
                    No</label>
            </td>
        </tr>
        <tr>
            <td>
                <div id="extra-fields-container" style="display: none;">
                    <div id="extra-fields">
                        <table class="info-table">
                            <tr>
                                <td style="width: 300px;">
                                    Title
                                </td>
                                <td>
                                    Details
                                </td>
                            </tr>
                        </table>
                    </div>
                    <asp:CustomValidator ID="CustomValidator1" runat="server" Display="Dynamic" OnServerValidate="CustomValidator1_Validate"
                        CssClass="alert" />
                    <input tabindex="5600" type="button" value="Add Another" onclick="addFields();" />
                </div>
            </td>
        </tr>
    </table>
    <table style="width: 100%;">
        <tr>
            <td>
                <label runat="server" class="label">
                    Upload Images
                </label>
            </td>
        </tr>
        <tr>
            <td>
                <table>
                    <tr>
                        <td>
                            <asp:FileUpload ID="FileUpload1" runat="server" TabIndex="9999" />
                            <br />
                            <asp:FileUpload ID="FileUpload2" runat="server" TabIndex="9999" />
                            <br />
                            <asp:FileUpload ID="FileUpload3" runat="server" TabIndex="9999" />
                            <br />
                            <asp:FileUpload ID="FileUpload4" runat="server" TabIndex="9999" />
                            <br />
                            <asp:FileUpload ID="FileUpload5" runat="server" TabIndex="9999" />
                        </td>
                        <td>
                            <asp:FileUpload ID="FileUpload6" runat="server" TabIndex="9999" />
                            <br />
                            <asp:FileUpload ID="FileUpload7" runat="server" TabIndex="9999" />
                            <br />
                            <asp:FileUpload ID="FileUpload8" runat="server" TabIndex="9999" />
                            <br />
                            <asp:FileUpload ID="FileUpload9" runat="server" TabIndex="9999" />
                            <br />
                            <asp:FileUpload ID="FileUpload10" runat="server" TabIndex="9999" />
                        </td>
                        <td>
                            <asp:FileUpload ID="FileUpload11" runat="server" TabIndex="9999" />
                            <br />
                            <asp:FileUpload ID="FileUpload12" runat="server" TabIndex="9999" />
                            <br />
                            <asp:FileUpload ID="FileUpload13" runat="server" TabIndex="9999" />
                            <br />
                            <asp:FileUpload ID="FileUpload14" runat="server" TabIndex="9999" />
                            <br />
                            <asp:FileUpload ID="FileUpload15" runat="server" TabIndex="9999" />
                        </td>
                        <td>
                            <asp:FileUpload ID="FileUpload16" runat="server" TabIndex="9999" />
                            <br />
                            <asp:FileUpload ID="FileUpload17" runat="server" TabIndex="9999" />
                            <br />
                            <asp:FileUpload ID="FileUpload18" runat="server" TabIndex="9999" />
                            <br />
                            <asp:FileUpload ID="FileUpload19" runat="server" TabIndex="9999" />
                            <br />
                            <asp:FileUpload ID="FileUpload20" runat="server" TabIndex="9999" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <div class="note">
                    Increase the visibility of your advertisement by uploading images. <a href="/why/upload-image-to-increase-visibility.mix"
                        target="_blank" title="Opens in a New Tab" tabindex="10000">Learn How?</a>
                    <hr class="hr" />
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Literal ID="ImageLiteral" runat="server" />
            </td>
        </tr>
        <tr>
            <td>
                <div class="alert">
                    <asp:Literal ID="CustomErrorLiteral" runat="server" />
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <input type="button" runat="server" value="Save" onserverclick="SaveButton_Click"
                    tabindex="11000" />
            </td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ScriptsContentPlaceHolderBottom"
    runat="server">
    <script type="text/javascript">
        var wdm = jQuery('#WdmTextBox');
        var preview = jQuery('#wmd-preview');


    </script>
    <script type="text/javascript">
        jQuery(document).ready(function () {







            $("#WdmTextBox").scroll(function () {
                $("#preview").scrollTop($("#WdmTextBox").scrollTop());
                $("#preview").scrollRight($("#WdmTextBox").scrollRight());
            });
            $("#preview").scroll(function () {
                $("#WdmTextBox").scrollTop($("#preview").scrollTop());
                $("#WdmTextBox").scrollRight($("#preview").scrollRight());
            });
















            var priceTypeRadioButtonList = jQuery("#PriceTypeRadioButtonList");
            var priceTextBox = jQuery("#PriceTextBox");

            priceTypeRadioButtonList.change(function () {
                var priceType = priceTypeRadioButtonList.find(":checked").val();

                if (priceType == 0) {
                    priceTextBox.attr("disabled", "disabled");
                    priceTextBox.attr("price", priceTextBox.val());
                    priceTextBox.val('');
                }
                else {
                    priceTextBox.removeAttr("disabled");
                    priceTextBox.val(priceTextBox.attr("price"));
                }
            }
        );





            (function () {
                var converter1 = Markdown.getSanitizingConverter();
                var editor1 = new Markdown.Editor(converter1);
                editor1.run();
            })();



        });


        var counter = 1;

        var addFields = function (name, value) {
            if (!name) { name = ''; }
            if (!value) { value = ''; }
            var html = ['<table class="info-table" id="extrafield' + counter + '-table">',
                        '<tr>',
                            '<td style="width: 300px;">',
                                '<input tabindex="5500" id="extrafield' + counter + '" name="extrafield' + counter + '" type="text" style="width: 270px!important;" class="textbox" value="' + name + '" />',
                            '</td>',
                            '<td>',
                                '<input tabindex="5500" id="extrafield' + counter + '-value" name="extrafield' + counter + '-value" type="text" style="width: 400px;" class="textbox" value="' + value + '" />',
                                '<input tabindex="5500" type="button" value="Remove" onclick="var t =jQuery(\x27#extrafield' + counter + '-table\x27); t.fadeOut(500, function() { t.remove(); });" />',
                            '</td>',
                        '</tr>',
                    '</table>'].join('\n');

            var newField = $(document.createElement('div')).attr("id", 'extrafielddiv' + counter);
            newField.html(html);

            newField.appendTo('#extra-fields');
            counter++;
        }

        var addOtherFields = function (names, values) {
            var nameArray = names.split('++--++-MixNP-++--++');
            var valueArray = values.split('++--++-MixNP-++--++');

            for (var i = 0; i < nameArray.length; i++) {
                addFields(nameArray[i], valueArray[i]);
            }

            $("#AddFieldYesRadio").prop("checked", true);
            $('#extra-fields-container').show(1000);
        }

        var deleteImage = function (path) {
            if (confirm('Are you sure you want to delete this file?')) {
                __doPostBack('DeleteFile', path);
            }
        }

        function doPostBackAsync(eventName, eventArgs) {
            var prm = Sys.WebForms.PageRequestManager.getInstance();

            if (!Array.contains(prm._asyncPostBackControlIDs, eventName)) {
                prm._asyncPostBackControlIDs.push(eventName);
            }

            if (!Array.contains(prm._asyncPostBackControlClientIDs, eventName)) {
                prm._asyncPostBackControlClientIDs.push(eventName);
            }

            __doPostBack(eventName, eventArgs);
        }

    </script>
</asp:Content>
